package com.jml.netty.手写dubbo.server.consumer;

import org.I0Itec.zkclient.ZkClient;

import java.util.List;

public class ServiceDiscover {
    /**
     * zk连接地址
     */
    private final String zkServers = "127.0.0.1";
    /**
     * 会话时间
     */
    private final int connectionTimeout = 5000;
    /***
     * zkClient
     */
    private ZkClient zkClient;


    private String rootNamePath = "/jmlrpc";

    public ServiceDiscover() {
        // 1. 连接zk连接
        zkClient = new ZkClient(zkServers, connectionTimeout);
    }


    public List<String> getDiscover(String serviceName) {
        List<String> children = zkClient.getChildren(rootNamePath + "/" + serviceName + "/providers");
        return children;
    }

}